<?php
/**
 * Created by PhpStorm.
 * User: man0sions
 * Date: 16/8/30
 * Time: 下午4:22
 */

namespace src\Factory;

/**
 * 抓取数据的格式工厂
 * 需要实现
 * 1:palylist数据的格式化
 * 2:video数据的格式化
 * Class SpiderDataFactory
 * @package src\Factory
 */
abstract class SpiderDataFactory
{
    /**
     * 根据不同的策略决定需要把数据格式化成什么类型
     * @var FormatSrtategy
     */
    protected $formatStrategy;

    /**
     *
     * SpiderDataFactory constructor.
     * @param FormatSrtategy $formatSrtategy
     */
    function __construct(FormatSrtategy $formatSrtategy)
    {
        $this->formatStrategy = $formatSrtategy;
    }

    /**
     * 格式化playlist数据
     * @param \stdClass $class
     * @return mixed
     */
    abstract function createPlaylistData(\stdClass $class);

    /**
     * 格式化video数据
     * @param \stdClass $class
     * @return mixed
     */
    abstract function createVideoData(\stdClass $class);
}